'Test #5 'taken by Maksim Ivanenko 'for IT310 'on 04/14/01 'Do Loops, Sequential files Option Explicit 'declaring data type Dim varName As String, varOnhand As Single Private Sub cmdCreate_Click() 'opening file for output data Open "a:\Test #5\SOH.txt" For Output As #1 'requesting info from user varName = InputBox("Enter Name of Item.", "Items Name.") 'loop with condition to exit when no more typig is done Do While varName <> "" 'requesting quantity from user varOnhand = Val(InputBox("Enter number of inventory on hand", "Quantity.")) 'saving data on file #1 Write #1, varName, varOnhand 'requesting new info or condition to exit loop varName = InputBox("Enter Items Name. If you prefer to quit ----> click on cancel button.", "Items Name") 'end of loop Loop 'to close file Close #1 End Sub Private Sub cmdDisplay_Click() 'opening file for reading Open "a:\Test #5\SOH.txt" For Input As #1 'condition to access all info on file Do While Not EOF(1) 'reading info from file Input #1, varName, varOnhand 'condition to select inventory with requested parameters If varOnhand < 30 Then 'displaying info on Form Print varName 'end of if condition End If 'end of loop Loop 'closing file #1 Close #1 End Sub